<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg width="400" height="400">
    <rect id="target" x="10" y="10" width="80" height="80" />
</svg>
<script>
'use strict';

// From UseCounter.h
var SVGSMILBeginOrEndEventValue = 1455;
var SVGSMILBeginOrEndSyncbaseValue = 1456;

test(() => {
    var target = document.getElementById('target');
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animate");
    animation.setAttribute("end", "5s;7s");
    target.appendChild(animation);
    assert_false(internals.isUseCounted(document, SVGSMILBeginOrEndEventValue));
    assert_false(internals.isUseCounted(document, SVGSMILBeginOrEndSyncbaseValue));
}, 'end list using time is not counted as event or syncbase value.');

test(() => {
    var target = document.getElementById('target');
    assert_false(internals.isUseCounted(document, SVGSMILBeginOrEndSyncbaseValue));
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animate");
    animation.setAttribute("end", "anim.begin - 5s;15s");
    target.appendChild(animation);
    assert_true(internals.isUseCounted(document, SVGSMILBeginOrEndSyncbaseValue));
}, 'end list using syncbase-value is use counted.');

test(() => {
    var target = document.getElementById('target');
    assert_false(internals.isUseCounted(document, SVGSMILBeginOrEndEventValue));
    var animation = document.createElementNS("http://www.w3.org/2000/svg", "animate");
    animation.setAttribute("end", "0s;anim.repeatEvent-4s;5s");
    target.appendChild(animation);
    assert_true(internals.isUseCounted(document, SVGSMILBeginOrEndEventValue));
}, 'end list using event-value is use counted.');

</script>
